UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ni146oYRBM11EVTHUXAoT75jieR08aXSs4G88m0ArzE=' 
WHERE 
  key_id = 'd7664c0894eef5fe05ff1b2df2c8367653fd3bfbbf1b67ea35b53396e37f879f' 
  AND (
    token = 'Ni146oYRBM11EVTHUXAoT75jieR08aXSs4G88m0ArzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022