UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v/48eHGhVdZ3SYpECiW/StHZQ5wdoiq9+uxGT4dHT3M=' 
WHERE 
  key_id = 'f2f14d9e411b2622afc704f4af305e0c14469b1a6705d8c264227be4c5e55614' 
  AND (
    token = 'v/48eHGhVdZ3SYpECiW/StHZQ5wdoiq9+uxGT4dHT3M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055