UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J+nT0CAoRib3TDbGXbdKX7bU88GM53hqlndxYNhtCPs=' 
WHERE 
  key_id = '96c76b257570723fc4009ad80d7e268d3726485c1a2304bba20128ba779ccd47' 
  AND (
    token = 'J+nT0CAoRib3TDbGXbdKX7bU88GM53hqlndxYNhtCPs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030