UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h9mepoFAYfdV+pzE15GztOnMqcM9qjOZqL7L3bOVmGM=' 
WHERE 
  key_id = 'c397bc6d52e694eefc4cf725bde8b32aab3ba71e584aeaa4d58be570ae9f2585' 
  AND (
    token = 'h9mepoFAYfdV+pzE15GztOnMqcM9qjOZqL7L3bOVmGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039