UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'emF1aWkh16P0ZN89EeCifpJgf/z3Ux6XxqbDRHMZMrU=' 
WHERE 
  key_id = 'f0236522957937d8317a9440c61b94f86bdd660492be372d41d8ee9e74a23798' 
  AND (
    token = 'emF1aWkh16P0ZN89EeCifpJgf/z3Ux6XxqbDRHMZMrU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034