UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VNcmZKg6I0ABAyQaLMiV/qicDHmiMyCfVExDIeXScMI=' 
WHERE 
  key_id = '332fc998c3f486ce7535140254316a7ef890e5e06b8a9b4f7036ec341528de90' 
  AND (
    token = 'VNcmZKg6I0ABAyQaLMiV/qicDHmiMyCfVExDIeXScMI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028