UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MGSafLX9sww+jwkgWqAy289zERhBipll+kOQU+HyEi4=' 
WHERE 
  key_id = 'd78c0398b8ccc0da8868a76aac3f19e6b5c17bd16e1a4e3ddc95cef69cada097' 
  AND (
    token = 'MGSafLX9sww+jwkgWqAy289zERhBipll+kOQU+HyEi4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034