UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CQVi7b0AL/R2/+eKNpWDuCzPfRjv6a1hpzpmrAdKsOo=' 
WHERE 
  key_id = '485fbb8cabc353235f49877426e0413f84ee95a37805d18f0092be80244bf2e7' 
  AND (
    token = 'CQVi7b0AL/R2/+eKNpWDuCzPfRjv6a1hpzpmrAdKsOo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036