UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6Np8sHsGmWJwyDwmauW2m9Xmg2YE/RA3eK/bBZ2dzCM=' 
WHERE 
  key_id = '598d724251e7a7943f30d7976b69d27367f16b1a52336ed75381010b53920228' 
  AND (
    token = '6Np8sHsGmWJwyDwmauW2m9Xmg2YE/RA3eK/bBZ2dzCM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014