UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm17Jih3mSCKhc2uy8v2INPpT7qZIJRzIiOGHJoIQJKA=' 
WHERE 
  key_id = '8960e033d566c89b7ecf5f8323ce991b58a6e019db69b12a880debbd37171eb8' 
  AND (
    token = 'm17Jih3mSCKhc2uy8v2INPpT7qZIJRzIiOGHJoIQJKA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026