UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gzay1qxBa4721GpO7h951CMDMT/M4DJlSrfPYIDGSOo=' 
WHERE 
  key_id = '21690cccd16430f482fc0201f70a7512cf58a376024f68d4918d90b169f6edbc' 
  AND (
    token = 'Gzay1qxBa4721GpO7h951CMDMT/M4DJlSrfPYIDGSOo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046