UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hjgYYaHmdYnKvYBf8U1Qx5slJi17qXGivCW2A/uvOJE=' 
WHERE 
  key_id = 'cc49a23c502dfc4d135c888457a87f45cd08f61b47b4c66b3687595388f3c215' 
  AND (
    token = 'hjgYYaHmdYnKvYBf8U1Qx5slJi17qXGivCW2A/uvOJE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00087