UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OcME695LlXEUMk2+SuQTgh/GSX/q7uOeXOpHUA/HMt0=' 
WHERE 
  key_id = '813c39856a10532e7a306336fe78555e8d02866c736321b82298726754b5cdd2' 
  AND (
    token = 'OcME695LlXEUMk2+SuQTgh/GSX/q7uOeXOpHUA/HMt0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029