UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k881poxtV+gPMhhqU5zi1SjFOZn7P6+ecPax/9+5YxU=' 
WHERE 
  key_id = 'ea3ed4442b7531d0578cd0817369347a8b74c4cada626343b85420267bc48e7f' 
  AND (
    token = 'k881poxtV+gPMhhqU5zi1SjFOZn7P6+ecPax/9+5YxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038