UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'brT9xlo0bDhKiQVzrjE08R+/tGaVfGIJK2Pl52jGCAA=' 
WHERE 
  key_id = '30717ee8782828e08eab59ed1434abfc430adb0a4b980bbf5ca0d32cab6ff8e8' 
  AND (
    token = 'brT9xlo0bDhKiQVzrjE08R+/tGaVfGIJK2Pl52jGCAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050