UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cHNUam/G/si4aaX9WgxHOhpW6cY0wcsOco4yH52VRNo=' 
WHERE 
  key_id = 'db0e5b3c0469a5d37b682c433704021b31e2b77349b221d842ab10a50727279f' 
  AND (
    token = 'cHNUam/G/si4aaX9WgxHOhpW6cY0wcsOco4yH52VRNo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032