UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dP+MAe+R2nEb24zCmZXPshj1P+ZJocnZ6OcGhrC2b3s=' 
WHERE 
  key_id = 'ab2c64da34c108566666506f8fdc94f5bf740b641f51cb09f051b8815202adf6' 
  AND (
    token = 'dP+MAe+R2nEb24zCmZXPshj1P+ZJocnZ6OcGhrC2b3s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020