UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7Zmh6O3mDkgYFUjio9veT7AToB6QZZTYya2ONxHsrQs=' 
WHERE 
  key_id = '37f3808290150801da40261341a929a4b0920199e7685fbd7e9c61a43a8c31a5' 
  AND (
    token = '7Zmh6O3mDkgYFUjio9veT7AToB6QZZTYya2ONxHsrQs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031