UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FgbcdIF7XwTRxDhCPuKk2bCau+RqnjuMdODmfw1tvaA=' 
WHERE 
  key_id = 'ce0f679401744b73a55d066802f6202c07b5f2c1c7f386cb29070feb281e8552' 
  AND (
    token = 'FgbcdIF7XwTRxDhCPuKk2bCau+RqnjuMdODmfw1tvaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024