UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k3Vvqxd6AhsYxDVaL8kvaDJKNTpP0x8y0jAS2UaGIAk=' 
WHERE 
  key_id = '9f1a9b1c7de0cd1661156840fc2d78eb4288445ee3209ae1f9767330835c6378' 
  AND (
    token = 'k3Vvqxd6AhsYxDVaL8kvaDJKNTpP0x8y0jAS2UaGIAk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043