UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B+5fIOuJtDKZcwzLLYUFkR2PxDX9M0kt63w24FtrCLk=' 
WHERE 
  key_id = '3de4c9df6e73672dd1c031b812eec35d34a4c57e4a94d1882cb9802a47d4fbc1' 
  AND (
    token = 'B+5fIOuJtDKZcwzLLYUFkR2PxDX9M0kt63w24FtrCLk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048