UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uj46gysfvo+L2VyDJ9yRDTSDdoQZyliMnjhUAvIeQrM=' 
WHERE 
  key_id = '3d910a77b4681e512a374b2a451d7e33628cb780a86046d73466bfba4f068f6c' 
  AND (
    token = 'uj46gysfvo+L2VyDJ9yRDTSDdoQZyliMnjhUAvIeQrM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029