UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Ss117zeLmykr9JWYCfVRuKLJoOgLvDqPZNDZAGloWQ=' 
WHERE 
  key_id = '3e8a358233ac0d4e8079138f42380848c837ec46efc44bba10e8233546996f7a' 
  AND (
    token = '0Ss117zeLmykr9JWYCfVRuKLJoOgLvDqPZNDZAGloWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040