UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TPNawBNiArrSGko8HRHE715YvIBh0RMdyGBoFpOxyA4=' 
WHERE 
  key_id = '833ab9580ad9d849e09d15acfb860e86b0088c4cc08169691606daa9482f64df' 
  AND (
    token = 'TPNawBNiArrSGko8HRHE715YvIBh0RMdyGBoFpOxyA4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046