UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QCkr2Vu0Q6xujoEsrHfx6hpOUyn8yhQGdPbifSamims=' 
WHERE 
  key_id = '09a3260875c4245175db58cf6c3c979e718dfa031e474a5a265ea5fb94562d90' 
  AND (
    token = 'QCkr2Vu0Q6xujoEsrHfx6hpOUyn8yhQGdPbifSamims=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057