UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sA+XJ9za7ml+tLJjdRBhg6LDZoHnyd+NyZKBlz6kONc=' 
WHERE 
  key_id = 'ff0de3b4748d15321ae9c4eae00727a14f78ef5b2a417951b3f84fd3c723db54' 
  AND (
    token = 'sA+XJ9za7ml+tLJjdRBhg6LDZoHnyd+NyZKBlz6kONc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036