UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JqwYer2E/ZusElBDZ0cQZiM31TNqy7zsjBEUMHDt+Ag=' 
WHERE 
  key_id = 'c75444ee9477458448efeda2d0be8365bd390fef536eb33ecebe0665147ce787' 
  AND (
    token = 'JqwYer2E/ZusElBDZ0cQZiM31TNqy7zsjBEUMHDt+Ag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044