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

Query time 0.00043