UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X6gItVEjRNRRQPpohoH2FtRlfO1PgqDWajHD053lgts=' 
WHERE 
  key_id = 'fe361342709cdabb7e316d7de0294d8f61b39d385c750a83db9ee91eeac58d8a' 
  AND (
    token = 'X6gItVEjRNRRQPpohoH2FtRlfO1PgqDWajHD053lgts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049