UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FTUk/qPaaKv5cEx+uU1zE9QamVydjreizE/6iKL0+Yk=' 
WHERE 
  key_id = '425b1ee883c9eeade6520b29bfec79c269da3fccf52e1ebc7599090eca7503f7' 
  AND (
    token = 'FTUk/qPaaKv5cEx+uU1zE9QamVydjreizE/6iKL0+Yk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00086