UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V74YylOQiuR4U5li2JbZY89/e4H6PgaOFF42HgfrKUA=' 
WHERE 
  key_id = 'f4e25bf66483021d62faa1f5cdc4d2e9694b53dc6c3e61501b10b1724f027089' 
  AND (
    token = 'V74YylOQiuR4U5li2JbZY89/e4H6PgaOFF42HgfrKUA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036